<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateAdminsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::dropIfExists('admins');
        Schema::create('admins', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('user_name')->default('')->comment('用户名称');
            $table->string('login_name')->default('')->comment('登录用户名称');
            $table->string('password')->default('')->comment('密码');
            $table->string('avatar')->default('')->comment('头像');
            $table->string('user_agent', 5000)->default('')->comment('设备信息');
            $table->string('last_login_ip')->default()->comment('最后登录ip');
            $table->timestamp('last_login_at')->default('2020-01-01')->comment('最后登录时间');
            $table->integer('role_id')->default(1)->comment('角色id');
            $table->timestamps();
            $table->softDeletes();
            $table->comment('管理员表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('admins');
    }
}
